<?php
class Model_Order extends ORM {

	public function rules() {
		return array(
			'bill_add' => array(
				array('not_empty')
			),
			'ship_add' => array(
				array('not_empty')
			),
			'shipping_method' => array(
				array('not_empty')
			),
		);
	}
	
	protected $_belongs_to = array(
		'user' => array(
			'model' => 'user',
			'foreign_key' => 'user_id',
		),
	);
	
	protected $_has_one = array(
		'transaction' => array(
			'model' => 'transaction',
			'foregin_key' => 'order_id',
		),
	);
	
	protected $_has_many = array(
		'order_items' => array(
			'model' => 'orderitem',
			'foregin_key' => 'order_id',
		),
	);
}